package com.hsc.yalebao.tools;

import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore.Audio.Media;
import android.provider.MediaStore.Images.Media;
import android.provider.MediaStore.Video.Media;
import java.io.File;

public class AppFinal
{
  public static String CACHE_DIR;
  public static String CACHE_DIR_IMAGE;
  public static String CACHE_DIR_UPLOADING_IMG;
  public static final int FAILED = 1;
  public static String HUIFU;
  public static String IMAGE_UNSPECIFIED;
  public static final int NET_FAILED = 2;
  public static int POST_CONTACT_SUCCESS = 0;
  public static final int RESULT_CODE_CAMERA = 1;
  public static final int RESULT_CODE_PHOTO_CUT = 3;
  public static final int RESULT_CODE_PHOTO_PICKED = 2;
  public static final int SUCCESS = 1;
  public static final int TIME_OUT = 3;

  static
  {
    IMAGE_UNSPECIFIED = "image/*";
    HUIFU = "common/back.gif";
    if ("mounted".equals(Environment.getExternalStorageState()));
    for (CACHE_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + "/yalebao"; ; CACHE_DIR = Environment.getRootDirectory().getAbsolutePath() + "/yalebao")
    {
      CACHE_DIR_UPLOADING_IMG = CACHE_DIR + "/uploading_img";
      CACHE_DIR_IMAGE = CACHE_DIR + "/pic";
      File localFile1 = new File(CACHE_DIR);
      if (!localFile1.exists())
        localFile1.mkdirs();
      File localFile2 = new File(CACHE_DIR_UPLOADING_IMG);
      if (!localFile2.exists())
        localFile2.mkdirs();
      File localFile3 = new File(CACHE_DIR_IMAGE);
      if (!localFile3.exists())
        localFile3.mkdirs();
      return;
    }
  }

  public static String getDataColumn(Context paramContext, Uri paramUri, String paramString, String[] paramArrayOfString)
  {
    Cursor localCursor = null;
    String[] arrayOfString = { "_data" };
    try
    {
      localCursor = paramContext.getContentResolver().query(paramUri, arrayOfString, paramString, paramArrayOfString, null);
      if ((localCursor != null) && (localCursor.moveToFirst()))
      {
        String str = localCursor.getString(localCursor.getColumnIndexOrThrow("_data"));
        return str;
      }
    }
    finally
    {
      if (localCursor != null)
        localCursor.close();
    }
    if (localCursor != null)
      localCursor.close();
    return null;
  }

  public static String getPath(Context paramContext, Uri paramUri)
  {
    int i;
    String str1;
    if (Build.VERSION.SDK_INT >= 19)
    {
      i = 1;
      if ((i == 0) || (!DocumentsContract.isDocumentUri(paramContext, paramUri)))
        break label247;
      if (!isExternalStorageDocument(paramUri))
        break label97;
      String[] arrayOfString3 = DocumentsContract.getDocumentId(paramUri).split(":");
      boolean bool4 = "primary".equalsIgnoreCase(arrayOfString3[0]);
      str1 = null;
      if (bool4)
        str1 = Environment.getExternalStorageDirectory() + "/" + arrayOfString3[1];
    }
    label97: label247: boolean bool1;
    do
    {
      boolean bool2;
      do
      {
        return str1;
        i = 0;
        break;
        if (isDownloadsDocument(paramUri))
        {
          String str3 = DocumentsContract.getDocumentId(paramUri);
          return getDataColumn(paramContext, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(str3).longValue()), null, null);
        }
        bool2 = isMediaDocument(paramUri);
        str1 = null;
      }
      while (!bool2);
      String[] arrayOfString1 = DocumentsContract.getDocumentId(paramUri).split(":");
      String str2 = arrayOfString1[0];
      Uri localUri;
      if ("image".equals(str2))
        localUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
      while (true)
      {
        String[] arrayOfString2 = new String[1];
        arrayOfString2[0] = arrayOfString1[1];
        return getDataColumn(paramContext, localUri, "_id=?", arrayOfString2);
        if ("video".equals(str2))
        {
          localUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
        }
        else
        {
          boolean bool3 = "audio".equals(str2);
          localUri = null;
          if (bool3)
            localUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
        }
      }
      if ("content".equalsIgnoreCase(paramUri.getScheme()))
      {
        if (isGooglePhotosUri(paramUri))
          return paramUri.getLastPathSegment();
        return getDataColumn(paramContext, paramUri, null, null);
      }
      bool1 = "file".equalsIgnoreCase(paramUri.getScheme());
      str1 = null;
    }
    while (!bool1);
    return paramUri.getPath();
  }

  public static boolean isDownloadsDocument(Uri paramUri)
  {
    return "com.android.providers.downloads.documents".equals(paramUri.getAuthority());
  }

  public static boolean isExternalStorageDocument(Uri paramUri)
  {
    return "com.android.externalstorage.documents".equals(paramUri.getAuthority());
  }

  public static boolean isGooglePhotosUri(Uri paramUri)
  {
    return "com.google.android.apps.photos.content".equals(paramUri.getAuthority());
  }

  public static boolean isMediaDocument(Uri paramUri)
  {
    return "com.android.providers.media.documents".equals(paramUri.getAuthority());
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tools.AppFinal
 * JD-Core Version:    0.6.2
 */